<%-- 
    Document   : warehouseManager
    Created on : May 14, 2010, 9:15:39 PM
    Author     : longdm
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%--
    This file is an entry point for JavaServer Faces application.
--%>
<f:view>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Warehouse manager page</title>
    </head>
    <body>
        <h1><h:outputText value="Warehouse Manager" /></h1>
        <img src="images/Koenigsegg.jpg" alt="images" height="269" width="619"/>
        <h:form>
            <h:commandLink action="#{WarehouseController.toNewWarehouse}" value="New Warehouse"/>
            <h:panelGroup rendered="#{WarehouseController.warehouseDataModel.rowCount == 0}">
                <h:outputText value="No warehouse found"/>
            </h:panelGroup>
            <h:panelGroup rendered="#{WarehouseController.warehouseDataModel.rowCount > 0}">
                <h:dataTable value="#{WarehouseController.warehouseDataModel}" var="wh" border="1" bgcolor="lightgray">
                    <h:column>
                    <f:facet name="header">
                        <h:outputText value="Warehouse Id"/>
                    </f:facet>
                    <h:outputText value="#{wh.warehouseId}"/>
                    </h:column>

                    <h:column>
                    <f:facet name="header">
                        <h:outputText value="Warehouse Name"/>
                    </f:facet>
                    <h:outputText value="#{wh.warehouseName}"/>
                    </h:column>

                    <h:column>
                    <f:facet name="header">
                        <h:outputText value="Company"/>
                    </f:facet>
                    <h:outputText value="#{wh.companyId.companyName}"/>
                    </h:column>

                    <h:column>
                    <f:facet name="header">
                        <h:outputText value="Location"/>
                    </f:facet>
                    <h:outputText value="#{wh.location}"/>
                    </h:column>

                    <h:column>
                    <f:facet name="header">
                        <h:outputText value="Actions"/>
                    </f:facet>
                    <h:commandLink action="#{WarehouseController.toWarehouseEdit}" value="Update"/>
                    /
                    <h:commandLink action="#{WarehouseController.deleteWarehouse}" value="Delete" onclick="return confirm('Are you sure?')"/>
                    </h:column>
                </h:dataTable>
            </h:panelGroup>
            <img src="images/back.jpg" alt="images"/>
            <a href="faces/adminUser.jsp">Back</a>
        </h:form>
    </body>
</html>
</f:view>